import {reqShopCartList} from '@/api'
const state = {
  // 初始值
  shopList:[]
};
const mutations = {
  GETSHOPCART(state,shopList){
    state.shopList = shopList
  }
};
const actions = {
  async getShopCart(context){
    let res = await reqShopCartList()
    if(res.code == 200){
      console.log("购物车",res);
      context.commit('GETSHOPCART',res.data)
    }
  }
};
const getters = {
  shopList(state){
    return state.shopList[0] || {}
  }
};
export default {
  state,
  mutations,
  actions,
  getters
}